package com.autotest.glin.run;

import com.autotest.glin.common.RunCaseParams;
import com.autotest.glin.data.DataProviders;
import io.qameta.allure.Epic;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import io.restassured.RestAssured;
import io.restassured.http.Headers;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.hamcrest.Matchers.*;

import java.util.Map;

@Feature("班级功能测试")
public class product_inner_category {
    @BeforeClass
    public void setUp() {
        RestAssured.baseURI = "http://localhost";
        RestAssured.basePath = "/classes/fetch";
        RestAssured.port = 80;
    }
    @Story("班级详情测试")
    @Test(dataProvider = "dataprovider", dataProviderClass = DataProviders.class, description = "获取班级详情")
    public void runCase(String caseMeta, String params) {
        Response response = RunCaseParams.runCase(params, "get");
        response.prettyPrint();
        response.then().body("code",equalTo("PRECLASS0120204001"));
        Headers headers = response.getHeaders();
        Map<String, String> cookies = response.getCookies();
        int statusCode = response.statusCode();
        String statusLine = response.statusLine();
        String resString = response.getBody().toString();
    }

    @Story("班级邮箱格式验证")
    @Test(dataProvider = "emailTestProvider",dataProviderClass = DataProviders.class,description = "测试邮箱是否符合")
    public void testEmail(String input,String email){
        Assert.assertEquals(input+"@xdf.cn",email);
    }
}
